const pool = require('./db')

let service = {}

service.queryUsers = async ()=> {

    const [rows,fields] = await pool.query("SELECT * from sys_user")
    return rows;
}


service.queryUserInfo = async (username) =>{
    const [rows,fields] = await pool.query(`select * from sys_user where username=?`,[username]);
    return rows
}

service.queryUser = async (username,password) =>{
    const [rows,fields] = await pool.query(`select * from sys_user where username=? and password=?`,[username, password]);
    return rows[0];
}


module.exports = service